import { GET, POST, POSTJSON, PUT, DELETE, POSTFORM } from './index'

/**
 * 壁纸相关接口
 */

// 获取壁纸详情
const getWallpaperDetail = id => {
  const url = `/api/wallpaper/detail/${id}`
  return new Promise(resolve => {
    GET(url).then(res => {
      resolve(res)
    })
  })
}

// 更新壁纸下载量
const updateWallpaperDownloads = id => {
  const url = `/api/wallpaper/download/${id}`
  return new Promise(resolve => {
    POST(url).then(res => {
      resolve(res)
    })
  })
}

// 获取壁纸列表
const getWallpaperList = params => {
  const url = '/api/wallpaper/list'
  return new Promise(resolve => {
    GET(url, params).then(res => {
      resolve(res)
    })
  })
}

module.exports = {
  getWallpaperList,
  getWallpaperDetail,
  updateWallpaperDownloads
}